#include"rotors.h"

Rotors::Rotors():QWidget()
{


    /*
      Création des instances composants la main window
      */
    rotor1 = new Rotor(12);

    rotor2 = new Rotor(16);

    rotor3 = new Rotor(8);


    QGridLayout *layout_rotors = new QGridLayout;

    /*
      Partie layout
      */
    layout_rotors->addWidget(rotor3, 0,0,3,2);

    layout_rotors->addWidget(rotor2,0,7,3,2);

    layout_rotors->addWidget(rotor1, 0,14,3,2);

    this->setLayout(layout_rotors);


    /*
      Partie connect
      */


}
/*
  Partie définitions méthodes
  */
void Rotors::phase2_rotors()
{

    rotor1->phase2_rotor();
    rotor2->phase2_rotor();
    rotor3->phase2_rotor();
}

Rotor* Rotors::getRotor(int i)
{
    if (i == 1)
        return rotor1;
    if (i == 2)
        return rotor2;
    if(i == 3)
        return rotor3;
    exit(1);
}

void Rotors::refresh(QString pos_r1, QString pos_r2, QString pos_r3)
{
    rotor1->set_rotor(pos_r1);
    rotor2->set_rotor(pos_r2);
    rotor3->set_rotor(pos_r3);

}

void Rotors::raz_rotors()
{
    rotor1->raz_rotor();
    rotor2->raz_rotor();
    rotor3->raz_rotor();
}
